﻿@using MvcControls
@using MvcControls.Controls.Button
@using MvcControls.Controls.Parameters
@inherits WebViewPage<ICollection<SDM.Domain.Models.AccountModel>>, ILocalizable<SDM.Domain.Models.AccountModel.Texts>
@(Html.Custom()
.Grid(t => t)
.AddPropertyColumn(this.Localize(t => t.UserName), t => t.UserName)
.AddPropertyColumn(this.Localize(t => t.IsAdmin), t => t.IsAdmin)
.AddPropertyColumn(this.Localize(t => t.IsEnabled), t => t.IsEnabled)
.AddDynamicColumn(null, null, t => Html.Custom()
    .Button().Settings(s =>
                           {
                               s.Text = this.Localize(t2 => t2.Shared.Edit);
                               s.Action = new ActionParameter("EditAccount", routeValues: new { id = t.ID });
                           })
    +
    Html.Custom()
    .Button().Settings(s =>
                           {
                               s.Text = this.Localize(t2 => t2.Shared.Delete);
                               s.Type = ButtonControlInfo.ButtonType.Post;
                               s.Action = new ActionParameter("DeleteAccount", routeValues: new { id = t.ID });
                               s.ConfirmationText = this.Localize(t2 => t2.Shared.AreYouSure);
                           }))
.AddControlToPanel(Html.Custom().Button().Settings(s =>
                                                {
                                                    s.Text = this.Localize(t => t.Shared.Add);
                                                    s.Action = new ActionParameter("AddAccount");
                                                })))